version: '3.8'

services:
  frontend:
    container_name: name_frontend
    build:
      context: ./frontend
      dockerfile: ./Dockerfile
    ports:
      - 3000:3000
    volumes:
      - ./frontend:/usr/app
    env_file:
      - ./frontend/.env
    networks:
      - name
    depends_on:
      - backend
    restart: unless-stopped

  backend:
    container_name: name_backend
    build: ./backend
    image: directus/directus:10.9.2
    ports:
      - 8055:8055
    volumes:
      - ./backend/uploads:/directus/uploads
      - ./backend/extensions:/directus/extensions
    env_file:
      - ./backend/.env
    networks:
      - name
    depends_on:
      - database
    restart: unless-stopped
  
  database:
    container_name: name_database
    image: bitnami/mysql:8.0
    volumes:
      - ./backend/database:/docker-entrypoint-initdb.d
      - mysql_data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: "root"
      MYSQL_USER: "name"
      MYSQL_PASSWORD: "name"
      MYSQL_DATABASE: "name"
      MYSQL_AUTHENTICATION_PLUGIN: "mysql_native_password"
    networks:
      - name
    restart: unless-stopped

networks:
  name:

volumes:
  mysql_data: